package com.zxj.shop.admin.controller;


import com.zxj.shop.admin.entity.Permission;
import com.zxj.shop.admin.service.PermissionService;
import com.zxj.shop.admin.shiro.vo.PageVO;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/admin/setting/menu")
public class MenuApiController {

    @Autowired
    PermissionService permissionService;

    @RequiresRoles(value = {"admin","guest","superadmin"},logical = Logical.OR)
    @GetMapping("/list")
    public PageVO<Permission> list() {
        List<Permission> list = permissionService.list();
        return PageVO.pageVO(list, (long) list.size());
    }

}
